S Gate and S^\dagger Gate
Contents
5.6. S Gate and S\(^\dagger\) Gate#
We shall call \(S\) and \(S^\dagger\) gates SGate and SdgGate, respectively.
API References: SGate
API References: SdgGate
Definition#
\(S |0\rangle = |0\rangle, \qquad S |1\rangle = i|1\rangle\)
\(S^\dagger |0\rangle = |0\rangle, \qquad S^\dagger |1\rangle = -i|1\rangle\)
The qiskit circuit symbol is \(S\) for SGate and \(Sdg\) for SdgGate. They appear in quantum circuits as
from qiskit import QuantumCircuit
qc=QuantumCircuit(1)
qc.s(0)
qc.sdg(0)
qc.draw()
┌───┐┌─────┐ q: ┤ S ├┤ Sdg ├ └───┘└─────┘
Acting on a superposition state#
When SGate and SdgGate are applied to a super position state the coefficient is swapped. That is
Notice that the relative phase changes by \(e^{\pm i\pi/2} = \pm i\). Recall that \(Z\) changes the relative phase by \(e^{i \pi} = -1\). Further notice that \((e^{\pm i \pi/2})^2 = e^{i \pi}\). Hence, \(S^2 = (S^\dagger)^2 = Z\). Because of this relation, \(S\) is sometimes expressed as \(\sqrt{Z}\).
Setting \(c_0=c_1=\frac{1}{\sqrt{2}}\), we find basis transformation
Since \(S\) is unitary \(S S^\dagger = I\) and thus \(S^{-1}=S^\dagger\) and \((S^\dagger)^{-1} = S\). Now the inverse of (5.10) and SdgGate- fwd are
Combining HGate and SGate, we can transform the computational basis \(\{|0\rangle, |1\rangle\}\) to \(\{|L\rangle, |R\rangle\}\) by \(S H\) and its inverse is \(H S^\dagger\). Now, we know we can move from one basis to another by \(H\), \(S\), and \(SH\).
Qiskit Example 5.6.1 We demonstrate the above basis set transformation using Qiskit. First, we construct a quantum circuit corresponding to the following transformation
Notice that the whole operation can be written as \(H S^\dagger S H |0\rangle\) it can be simplified as
Hence, the whole operation does nothing at all. In order to avoid unnecessary computation like this, we need to understand the properties of gates. You will surprise that a long circuit can be significantly shortened by contracting gates.
%%capture
from qiskit import *
from qiskit.visualization import visualize_transition
qc=QuantumCircuit(1)
qc.h(0)
qc.s(0)
qc.sdg(0)
qc.h(0)
movie=visualize_transition(qc,fpg=50, spg=1)
qc.draw('mpl')
movie